{extend name="public:base" /}
{block name="title"}{$site_title}{/block}
{block name="content"}
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list">
                <i class="icon-font"></i>
                <a href="/baibu/admin/Index">首页</a>
                <span class="crumb-step">&gt;</span>
                <a class="crumb-name" href="/baibu/admin/Menu/Index">导航管理</a>
                <span class="crumb-step">&gt;</span>
                <span>{$nav}</span>
            </div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="{$url}" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <table class="insert-tab" width="100%">
                        <tbody><tr>
                            <th width="120">
                                <i class="require-red">*</i>导航名称：
                            </th>
                            <td>
                                <input class="common-text required" name="menu_name" size="50" value="{$info.menu_name|default=''}" type="text">
                            </td>
                        </tr>
                            <tr>
                                <th>导航标识：</th>
                                <td>
                                    <input name="menu_desc" class="common-text" size="50" value="{$info.menu_desc|default=''}" type="text">
                                </td>
                            </tr>
                            <!--<tr>-->
                                <!--<th>导航组：</th>-->
                                <!--<td>-->
                                    <!--<select name="menu_id" class="required">-->
                                        <!--<option value="1">标题导航</option>-->
                                        <!--<option value="2">分类导航</option>-->
                                        <!--<option value="3"></option>-->
                                    <!--</select>-->
                                <!--</td>-->
                            <!--</tr>-->
                            <tr>
                                <th>
                                    <i class="require-red">*</i>导航链接：
                                </th>
                                <td>
                                    <input class="common-text" name="menu_url" size="50" value="{$info.menu_url|default=''}" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th>状态：</th>
                                <td>
                                    {if isset($info.menu_status)}
                                    <input class="mui-switch mui-switch-anim" type="checkbox" {if $info.menu_status ==1}checked{/if}>
                                    {else /}
                                    <input class="mui-switch mui-switch-anim" type="checkbox" >
                                    {/if}
                                    <input class="s" type="hidden" value="{$info.menu_status|default=''}" name="menu_status">
                                    <input  type="hidden" value="{$info.menu_id|default=''}" name="menu_id">
                                </td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input id="sub" class="btn btn-primary btn6 mr10" value="提交" type="button">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <!--/main-->
{/block}
{block name="js"}
<script>
    $(function () {
        if(!$('.s').val()){
            $('.s').val(0);
        }
        $('.mui-switch-anim').click(function () {
            if($(this).prop("checked")){
                $('.s').val(1);
            }else{
                $('.s').val(0);
            }
        });

        $('#sub').click(function(){
            if($('input[name=menu_name]').val() == ''){
                layer.msg('导航不能为空', {icon: 5,time:1200});
                return;
            }
            if($('input[name=menu_url]').val() == ''){
                layer.msg('链接不能为空', {icon: 5,time:1200});
                return;
            }
            var url = $('form').attr('action');
            $.ajax({
                url : url,
                dataType : "json",
                type : "post",
                data : $('form').serialize(),
                success :function (data) {
                    if(data.status){
                        layer.msg(data.msg,{icon:1,time:1200,end:function () {
                                location.href=data.data;
                            }});
                    }else{
                        layer.msg(data.msg,{icon:5,time:1200});
                    }
                }
            });
        });
    });
</script>
{/block}